/**
 * 路由文件
 */
const express=require('express');
const service=require('./service.js');
const router=express.Router();
const multer=require('multer');
const uploadimg=multer({
    dest:"./public/img/"
  });
  const singleMidle=uploadimg.single("head");
//登录验证
router.post('/api/login',service.login);
//获取用户信息
router.get('/api/userinfo/:uid',service.userinfo);
//保存上传的头像
router.post('/api/upload',singleMidle,service.upload);
//修改头像信息
router.put('/api/updataimgurl',service.updataimgurl);
//修改用户信息
router.put('/api/updatainfo',service.updatainfo);
//修改用户密码
router.put('/api/updatapwd',service.updatapwd);
//获取所有部门信息
router.get('/api/getAlldepartment',service.getAlldepartment);
//获取所有职位信息
router.get('/api/getAllposition',service.getAllposition);
//部门搜索功能
router.get('/api/seach/:id',service.seach);
//职位搜索功能
router.get('/api/seach1/:id',service.seach1);
//员工薪资信息搜索功能
router.get('/api/seach2/:id',service.seach2);
//员工信息搜索功能
router.get('/api/seach3/:id',service.seach3);
//修改部门信息
router.put('/api/updatedepartment',service.updatedepartment);
//修改职位信息
router.put('/api/updateposition',service.updateposition);
//添加部门信息
router.post('/api/adddepartment',service.adddepartment);
//添加职位信息
router.post('/api/addposition',service.addposition);
//删除部门信息
router.delete('/api/deletedepartment/:id',service.deletedepartment);
//删除职位信息
router.delete('/api/deleteposition/:id',service.deleteposition);
//设置经理
router.put('/api/setdmanager',service.setdmanager);
//获取所有员工薪资信息
router.get('/api/getAllsalary',service.getAllsalary);
//修改员工薪资信息
router.put('/api/updatesalary',service.updatesalary);
//获取所有员工信息
router.get('/api/getAllinformation',service.getAllinformation);
//添加员工信息
router.post('/api/addinformation',service.addinformation);
//删除员工信息
router.delete('/api/deleteinformation/:id',service.deleteinformation);
//修改员工信息
router.put('/api/updateinformation',service.updateinformation);

//导出路由
module.exports=router;